package org.example.observerPattern;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 具体主题
 */
public class ConcreteSubject extends Subject{

    private static final Logger LOGGER = LoggerFactory.getLogger(ConcreteSubject.class);

    // 现有状态
    private String state;

    public void changeState(String newState) {
        // 主题修改之后，通知其他观察者
        this.state = newState;
        LOGGER.info("主题状态更新：{}", newState);
        notifyObservers(newState);
    }
}
